<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta http-equiv="X-UA-Compatible" content="ie=edge"><title>Document</title><style>.box{background:#ccc;width:500px;height:400px;margin-top:1000px;margin-left:auto;margin-right:auto}.box1{width:100px;height:1000px;margin-top:100px;background:red}</style></head><body><div class="box" id="box"></div><div class="box1"></div><script>!function(){var o=document.getElementById("box");o.offsetHeight,window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;window.onscroll=function(){var e,t,n;e=o.getBoundingClientRect(),t=document.documentElement.clientTop?document.documentElement.clientTop:0,n=document.documentElement.clientLeft?document.documentElement.clientLeft:0,e.top,e.bottom,e.left,e.right}}()</script></body></html>